/**
 *   \file list_all_interfaces.c
 *   \brief gcc -o list_all_interfaces list_all_interfaces.c -lvirt
 *
 *  Detailed description
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <libvirt/libvirt.h>

int main(int argc, char *argv[])
{
    virConnectPtr conn;
    virInterfacePtr *ifaces;
    int ret;

    conn = virConnectOpen("qemu:///system");
    if (conn == NULL)
    {
        fprintf(stderr, "Failed to connect to qemu:///system\n");
        return 1;
    }

    ret = virConnectListAllInterfaces(conn, &ifaces,
                                      VIR_CONNECT_LIST_INTERFACES_INACTIVE |
                                          VIR_CONNECT_LIST_INTERFACES_ACTIVE);
    printf("%d\n", ret);

    return 0;
}
